home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / INTR2.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  2KB  |  72 lines

  1. ;*****************************;
  2. ; WASM Interrupt Chaining     ;
  3. ; By Eric Tauck               ;
  4. ;                             ;
  5. ; Defines:                    ;
  6. ;                             ;
  7. ;   IntChn  chain interrupt   ;
  8. ;   IntRel  release interrupt ;
  9. ;   IntChk  check interrupt   ;
  10. ;                             ;
  11. ; Requires:                   ;
  12. ;                             ;
  13. ;   INTR.ASM                  ;
  14. ;*****************************;
  15.  
  16.         jmps    _intr2_end
  17.  
  18. ;================================================
  19. ; Chain interrupt.
  20. ;
  21. ; In: AL= interrupt; BX= interrupt variable; CX=
  22. ;     chain routine.
  23.  
  24. IntChn  PROC    NEAR
  25.         push    di
  26.         mov     di, bx                  ;variable address in DI
  27.         push    ax
  28.         push    cx
  29.         call    IntGet                  ;get interrupt
  30.         mov     [di], bx                ;save offset
  31.         mov     [di + 2], dx            ;save segment
  32.         pop     bx                      ;restore new offset
  33.         pop     ax                      ;restore interrupt
  34.         mov     dx, cs                  ;segment
  35.         call    IntSet                  ;set interrupt
  36.         pop     di
  37.         ret
  38.         ENDP
  39.  
  40. ;================================================
  41. ; Release interrupt.
  42. ;
  43. ; In: AL= interrupt; BX= interrupt variable.
  44.  
  45. IntRel  PROC    NEAR
  46.         mov     dx, [bx + 2]            ;segment
  47.         mov     bx, [bx]                ;offset
  48.         call    IntSet                  ;set interrupt
  49.         ret
  50.         ENDP
  51.  
  52. ;================================================
  53. ; Check if interrupt has been changed.
  54. ;
  55. ; In: AL= interrupt; DX:CX= chain routine.
  56. ;
  57. ; Out: ZF= set if unchanged.
  58.  
  59. IntChk  PROC    NEAR
  60.         push    cx
  61.         push    dx
  62.         call    IntGet                  ;get interrupt
  63.         pop     cx
  64.         pop     ax
  65.         cmp     bx, ax                  ;check offset
  66.         jne     _intch1
  67.         cmp     dx, cx                  ;check segment
  68. _intch1 ret
  69.         ENDP
  70.  
  71. _intr2_end
  72.